<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>login</title>
    <link rel="stylesheet" type="text/css" href="login_files/normalize.css">
    <link rel="stylesheet" type="text/css" href="login_files/demo.css">
    <!--必要样式-->
    <link rel="stylesheet" type="text/css" href="login_files/component.css">
    <!--[if IE]>
    <script src="js/html5.js"></script>
    <![endif]-->
</head>
<body>
<script language="JavaScript" src="./js/jquery-3.2.1.js"></script>
<div class="container demo-1">
    <div class="content">
        <div id="large-header" class="large-header" style="height: 318px;">
            <canvas id="demo-canvas" width="1536" height="318"></canvas>
            <div class="logo_box">
                <h3>欢迎你</h3>
                <form action="#" name="f" method="post">
                    <div class="input_outer">
                        <span class="u_user"></span>
                        <input name="loginName" id="loginName" class="text" style="color: #FFFFFF !important" placeholder="请输入账户" value="" type="text">
                    </div>
                    <div class="input_outer">
                        <span class="us_uer"></span>
                        <input name="pwd" id="pwd" class="text" style="color: #FFFFFF !important; position:absolute; z-index:100;" value="" placeholder="请输入密码" type="password">
                    </div>
                    <div class="mb2">
                        <input class="act-but submit" style="color: #FFFFFF; width: 330px" type="button" id="btnSend" name="submit" value="登录">
                    </div>
                </form>
            </div>
        </div>
    </div>
</div><!-- /container -->
<script src="login_files/TweenLite.js"></script>
<script src="login_files/EasePack.js"></script>
<script src="login_files/rAF.js"></script>
<script src="login_files/demo-1.js"></script>

</body>
<script language="JavaScript">
    $("#btnSend").click(function () {
        $.ajax({
            type:"POST",
            url:"loginServlet",
            contentType:"application/json; charset=utf-8",
            data:JSON.stringify(GetJsonData()),
            dataType:"json",
            success:function (msg) {

            },
            complete:function (data) {
                var jsonData = eval("("+data.responseText+")");
                if(jsonData.result === "true"){
                    window.location.href = jsonData.url;
                }else{
                    document.getElementById("loginName").value = "";
                    document.getElementById("pwd").value = "";
                    alert("账户不存在或密码错误！请重新登陆！");
                }
            }
        });
    });
    function GetJsonData() {
        var json = {
            "type":1,
            "loginName":$("#loginName").val(),
            "pwd":$("#pwd").val()
        };
        return json;
    }
</script>
</html>